package no.cicero.testframework.common.xml;

import org.xml.sax.Attributes;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

public class XmlAttributes {
    
    private ArrayList<String> attributes = null;
    private Map<String, String> byName = null;
    
    public XmlAttributes(Attributes a) {
        attributes = new ArrayList<String>();
        byName = new HashMap<String, String>();
        for(int i = 0; i < a.getLength(); ++i){
            String attName = a.getQName(i);
            String attValue = a.getValue(i);
            attributes.add(attValue);
            byName.put(attName, attValue);
        }
    }
    
    public String getValue(String name){
        return byName.get(name);
    }

    
}
